<%@page import="java.sql.*"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<!--
4.1.	Visualizzare i dati relativi al proprio account e modificare la password.
-->
<title>Modifica Dati</title>
</head>
<body>
	<% 
	HttpSession sessione = request.getSession(false);
	
	if(sessione.isNew()) {
		response.sendRedirect("../login2.html");
	}
	%>
	<CENTER>
<br>
<font size="8" style="font-style: italic" > Visualizza dati e modifica password </font> <BR><BR>
</CENTER>
	<%
		String username = (String) session.getAttribute("id");

		String driver = "oracle.jdbc.driver.OracleDriver";
    	String url = "jdcb:oracle:thin:aziendavinicola/filippo@localhost:1521:XE";
    	Class.forName(driver);
    	Connection con = DriverManager.getConnection(url);
  		Statement st = con.createStatement();
  		String dati = "SELECT * FROM accountutente, cliente WHERE username=codicecliente AND username='"+username+"'";
  		ResultSet rs = st.executeQuery(dati);
  		%>
  		
  		<%
  		if(rs.next()){ %>
  			Username <BR> <%out.println(rs.getString(1)); %>"<BR> <BR>
  			Nome <BR> <%out.println(rs.getString(5)); %>"<BR> <BR>
  			Cognome <BR> <%out.println(rs.getString(6)); %>"<BR> <BR>
  			Indirizzo <BR> <%out.println(rs.getString(8)); %>"<BR> <BR>
  			Ragione sociale <BR> <%out.println(rs.getString(7)); %>" <BR> <BR>
  			Email <BR> <%out.println(rs.getString(10)); %>"<BR> <BR>
  			Comune <BR> <%out.println(rs.getString(12)); %>"<BR> <BR>
  			<%
  		}
  		%>
  		<input type='submit' value="Conferma dati"/>
</body>
</html>